# i = j  # NameError: name 'j' is not defined

# print())    # SyntaxError: unmatched ')'

# a='123'
# print(a[3])    # IndexError: string index out of range

# d = {'a': 1, 'b': 2}
# print(d['c'])   # KeyError: 'c'

# year = int(input('input year:'))  #ValueError: invalid literal for int() with base 10: 'abc'


# try:
#     year = int(input('input year:'))
# except ValueError:
#     print('年份要输入数字')

# a=123
# a.append()  # AttributeError: 'int' object has no attribute 'append'

# try:
#     print(1/0)
# except ZeroDivisionError as e:
#     print('0不能做除数 %s' %e)

# try:
#     raise NameError('helloError')
# except NameError:
#     print('my custom error')


try:
    a = open('name.txt')
except Exception as e:
    print(e)
finally:
    a.close()
